#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>

/*
 *
 * void* mmap(void* start, size_t len, int prot, int flags, int fd, off_t offset)
 */

int main(void)
{
	int fd;
	void *start;
	struct stat sb;
	
	fd = open("/etc/passwd", O_RDONLY);
	fstat(fd, &sb);
	start = mmap(NULL, sb.st_size, 	PROT_READ, MAP_PRIVATE, fd, 0);
	if (start == MAP_FAILED)
		return -1;
	printf("%s", start);

	munmap(start, sb.st_size);
	close(fd);

	return 0;
}

#if 0


#endif
